package cn.momoshenchi.medicine.pojo;

import cn.momoshenchi.medicine.enumerate.Add;
import cn.momoshenchi.medicine.enumerate.Update;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 基础药品表
 * @TableName base_drug
 */
@TableName(value ="base_drug")
public class BaseDrug implements Serializable {
    /**
     * 药品id
     */
    @TableId(type = IdType.AUTO)
    @Null(groups = Add.class)
    @NotNull(message = "id不能为空",groups = Update.class)
    private Integer drugId;

    /**
     * 药品通用名称
     */
    @NotBlank(message = "药品名称不能为空",groups = Add.class)
    private String drugName;

    /**
     * 商品名
     */
    @NotBlank(message = "商品名称不能为空",groups = Add.class)
    private String tradeName;

    /**
     * 拼音码
     */
    @NotBlank(message = "拼音码不能为空",groups = Add.class)
    private String pinyinCode;

    /**
     * 药品规格
     */
    @NotBlank(message = "药品规格不能为空",groups = Add.class)
    private String specification;

    /**
     * 包装单位
     */
    @NotBlank(message = "药品包装单位不能为空",groups = Add.class)
    private String packUnit;

    /**
     * 药品价格
     */
    @NotNull(message = "药品价格不能为空",groups = Add.class)
    private BigDecimal price;

    /**
     * 剂量
     */
    @NotNull(message = "药品剂量不能为空",groups = Add.class)
    private BigDecimal dose;

    /**
     * 剂量单位
     */
    @NotBlank(message = "剂量单位不能为空",groups = Add.class)
    private String doseUnit;

    /**
     * 产地
     */
    private String factoryName;

    /**
     * 批准文号
     */
    private String approvalNumber;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * 药品id
     */
    public Integer getDrugId() {
        return drugId;
    }

    /**
     * 药品id
     */
    public void setDrugId(Integer drugId) {
        this.drugId = drugId;
    }

    /**
     * 药品通用名称
     */
    public String getDrugName() {
        return drugName;
    }

    /**
     * 药品通用名称
     */
    public void setDrugName(String drugName) {
        this.drugName = drugName;
    }

    /**
     * 商品名
     */
    public String getTradeName() {
        return tradeName;
    }

    /**
     * 商品名
     */
    public void setTradeName(String tradeName) {
        this.tradeName = tradeName;
    }

    /**
     * 拼音码
     */
    public String getPinyinCode() {
        return pinyinCode;
    }

    /**
     * 拼音码
     */
    public void setPinyinCode(String pinyinCode) {
        this.pinyinCode = pinyinCode;
    }

    /**
     * 药品规格
     */
    public String getSpecification() {
        return specification;
    }

    /**
     * 药品规格
     */
    public void setSpecification(String specification) {
        this.specification = specification;
    }

    /**
     * 包装单位
     */
    public String getPackUnit() {
        return packUnit;
    }

    /**
     * 包装单位
     */
    public void setPackUnit(String packUnit) {
        this.packUnit = packUnit;
    }

    /**
     * 药品价格
     */
    public BigDecimal getPrice() {
        return price;
    }

    /**
     * 药品价格
     */
    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    /**
     * 剂量
     */
    public BigDecimal getDose() {
        return dose;
    }

    /**
     * 剂量
     */
    public void setDose(BigDecimal dose) {
        this.dose = dose;
    }

    /**
     * 剂量单位
     */
    public String getDoseUnit() {
        return doseUnit;
    }

    /**
     * 剂量单位
     */
    public void setDoseUnit(String doseUnit) {
        this.doseUnit = doseUnit;
    }

    /**
     * 产地
     */
    public String getFactoryName() {
        return factoryName;
    }

    /**
     * 产地
     */
    public void setFactoryName(String factoryName) {
        this.factoryName = factoryName;
    }

    /**
     * 批准文号
     */
    public String getApprovalNumber() {
        return approvalNumber;
    }

    /**
     * 批准文号
     */
    public void setApprovalNumber(String approvalNumber) {
        this.approvalNumber = approvalNumber;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        BaseDrug other = (BaseDrug) that;
        return (this.getDrugId() == null ? other.getDrugId() == null : this.getDrugId().equals(other.getDrugId()))
            && (this.getDrugName() == null ? other.getDrugName() == null : this.getDrugName().equals(other.getDrugName()))
            && (this.getTradeName() == null ? other.getTradeName() == null : this.getTradeName().equals(other.getTradeName()))
            && (this.getPinyinCode() == null ? other.getPinyinCode() == null : this.getPinyinCode().equals(other.getPinyinCode()))
            && (this.getSpecification() == null ? other.getSpecification() == null : this.getSpecification().equals(other.getSpecification()))
            && (this.getPackUnit() == null ? other.getPackUnit() == null : this.getPackUnit().equals(other.getPackUnit()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
            && (this.getDose() == null ? other.getDose() == null : this.getDose().equals(other.getDose()))
            && (this.getDoseUnit() == null ? other.getDoseUnit() == null : this.getDoseUnit().equals(other.getDoseUnit()))
            && (this.getFactoryName() == null ? other.getFactoryName() == null : this.getFactoryName().equals(other.getFactoryName()))
            && (this.getApprovalNumber() == null ? other.getApprovalNumber() == null : this.getApprovalNumber().equals(other.getApprovalNumber()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getDrugId() == null) ? 0 : getDrugId().hashCode());
        result = prime * result + ((getDrugName() == null) ? 0 : getDrugName().hashCode());
        result = prime * result + ((getTradeName() == null) ? 0 : getTradeName().hashCode());
        result = prime * result + ((getPinyinCode() == null) ? 0 : getPinyinCode().hashCode());
        result = prime * result + ((getSpecification() == null) ? 0 : getSpecification().hashCode());
        result = prime * result + ((getPackUnit() == null) ? 0 : getPackUnit().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        result = prime * result + ((getDose() == null) ? 0 : getDose().hashCode());
        result = prime * result + ((getDoseUnit() == null) ? 0 : getDoseUnit().hashCode());
        result = prime * result + ((getFactoryName() == null) ? 0 : getFactoryName().hashCode());
        result = prime * result + ((getApprovalNumber() == null) ? 0 : getApprovalNumber().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", drugId=").append(drugId);
        sb.append(", drugName=").append(drugName);
        sb.append(", tradeName=").append(tradeName);
        sb.append(", pinyinCode=").append(pinyinCode);
        sb.append(", specification=").append(specification);
        sb.append(", packUnit=").append(packUnit);
        sb.append(", price=").append(price);
        sb.append(", dose=").append(dose);
        sb.append(", doseUnit=").append(doseUnit);
        sb.append(", factoryName=").append(factoryName);
        sb.append(", approvalNumber=").append(approvalNumber);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}